package com.mofofa.maozy.components.step

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.RelativeLayout
import com.mofofa.maozy.R
import com.mofofa.maozy.databinding.ViewMaozyInfoStepBinding

class InfoStep(context: Context, attrs: AttributeSet) :
    RelativeLayout(context, attrs) {

    private var mMaozyViewMaozyBinding: ViewMaozyInfoStepBinding
    private var vMaozyRootMaozyView: View

    init {
        vMaozyRootMaozyView = LayoutInflater.from(context).inflate(R.layout.view_maozy_info_step, this)
        mMaozyViewMaozyBinding = ViewMaozyInfoStepBinding.bind(vMaozyRootMaozyView)
    }

    fun setMaozyStartMaozyNode(): InfoStep {
        mMaozyViewMaozyBinding.vAdpterInfoLineLeft.visibility = GONE
        return this
    }

    fun setMaozyEndMaozyNode(): InfoStep {
        mMaozyViewMaozyBinding.vAdpterInfoLineRight.visibility = GONE
        return this
    }

    fun setMaozySelectedMaozyNode(selected: Boolean): InfoStep {
        if (selected) {
            mMaozyViewMaozyBinding.textAdpterInfoDot.setBackgroundResource(R.drawable.maozy_info_step_dot_selected)
        } else {
            mMaozyViewMaozyBinding.textAdpterInfoDot.setBackgroundResource(R.drawable.maozy_info_step_dot_unselect)
        }
        return this
    }
}